home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_gendoor.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  107 lines

  1. # Jones 3D Cog Script
  2. #
  3. # SHS_GenDoor.cog      Make doors open/close.  
  4. #
  5. # [JWC, SXC]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. message activated
  14. message    startup
  15.  
  16.  
  17. sector    doorsector
  18.  
  19. thing    door           
  20. thing   button       
  21. thing    player            local
  22. thing    interpcam
  23.  
  24. int      filter=0         local        # prevent multiple activates    
  25. int        position=0        local        # door position
  26. int     angle=90                    # which way door opens
  27.                                     # give choice of camera (l,c,r)
  28.          
  29.  
  30. end
  31.  
  32. # ========================================================================================
  33.  
  34. code
  35.  
  36.  
  37. startup:
  38.  
  39.     # turn off door sector
  40.     SetSectorAdjoins(doorsector, 0);
  41.        SetThingLight(door, '0.2 0.2 0.2', 0.01, 0.01);
  42.     player= GetLocalPlayerThing();
  43.     return;
  44.  
  45. activated:
  46.    
  47.     # TO DO: prevent activating with chalk
  48.     if (GetCurItem(player) != 0) return; # prevents activating with chalk
  49.  
  50.     if ((GetSenderRef() == button) && (filter == 0))
  51.     {
  52.         #Prep...
  53.         SetActorFlags(player, 0x200000);
  54.         StartCutscene(0);
  55.         StopThing(player);
  56.         DeselectWeapon(player);
  57.         DeselectWeaponWait(player);
  58.         
  59.         # Camera stuff
  60.         SetExtCamOffsetToThing(interpCam);
  61.  
  62.         filter=1;
  63.         
  64.         PlayMode(player, 60, 0);
  65.         Sleep(.3); # synch with button
  66.  
  67.         # handle door
  68.         position = 1 - position;
  69.                  
  70.         MoveToFrame(button, 1, 1);
  71.         WaitForStop(button);
  72.                         
  73.         # open and close door
  74.         SetCollideType(door,0);     # make no collision 
  75.         if (position == 1)            # open door
  76.         {
  77.             # turn on door sector
  78.             SetSectorAdjoins(doorsector, 1);
  79.             # move door
  80.             Rotate(door, angle, 1, 1);
  81.             WaitForStop(door);
  82.         }
  83.            
  84.         if (position == 0)             # close door
  85.         {
  86.             Rotate(door, -angle, 1, 1);
  87.             WaitForStop(door);
  88.             # turn off door sector
  89.             SetSectorAdjoins(doorsector, 0);
  90.         }
  91.         
  92.         SetCollideType(door,3);        # resets collision
  93.         MoveToFrame(button, 0, 1);
  94.         WaitForStop(button);
  95.         RestoreExtCam();
  96.         ClearActorFlags(player, 0x200000);
  97.         EndCutscene();
  98.         filter=0;
  99.     }
  100.     return;
  101.     
  102. end
  103.  
  104.  
  105.  
  106.  
  107.